package com.yj_app.qualitytest.adapter;

import android.graphics.Color;
import android.provider.CalendarContract;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yj_app.qualitytest.R;
import com.yj_app.qualitytest.info.QStandardInfo;

import java.util.List;

public class CheckXmAdapter extends BaseQuickAdapter<QStandardInfo, BaseViewHolder> {
   private int oldPos=0, newPos=0;
    public void setCheckxmSelectPos(int oldPos, int newPos) {
        this.oldPos = oldPos;
       this.newPos=newPos;
        notifyItemChanged(oldPos);
        notifyItemChanged(newPos);
    }
    public CheckXmAdapter(int layoutResId, @Nullable List<QStandardInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, QStandardInfo item) {
        helper
                .setTextColor(R.id.one_tv,newPos==helper.getLayoutPosition()? Color.RED:Color.BLACK)
                .setText(R.id.one_tv,item.getCname());
    }

    public void restSelectPos() {
        oldPos=0;
        newPos=0;
    }
}
